package com.fisherman.test;

import com.fisherman.aop.MathCalculator;
import com.fisherman.config.MainConfigOfAop;
import com.fisherman.config.MainConfigOfLifeCycle;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @User: fisherman
 * @Date: 2020/5/20 11:20
 */
public class IOCTest_AOP {

    @Test
    public void test() {
        //1.创建ioc容器
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfigOfAop.class);

        MathCalculator mathCalculator = applicationContext.getBean(MathCalculator.class);

        mathCalculator.div(1, 0);

        //关闭容器
        applicationContext.close();
    }
}
